#include "stdafx.h"
#include <sgp/VideoSurfaceFwd.h>
#include <sgp/VideoManager.h>
#include <sgp/TimerManager.h>
#include <sgp/ImageManager.h>
#include <sgp/VideoSurfaceFwd.h>
#include <sgp/VideoSurface.h>
#include <sgp/Settings.h>
#include "Splash.h"

UINT32 guiSplashFrameFade = 10;
UINT32 guiSplashStartTime = 0;

namespace ja2
{
	//Simply create video surface, load image, and draw it to the screen.
	void init_splash_screen(sgp::VideoManager &VideoManager_, sgp::ImageManager &ImageManager, sgp::TimerManager &TimerManager_, sgp::Settings const &Settings_)
	{
//x#ifdef ENGLISH
//x		ClearMainMenu();
//x#else
/*
		// Create splash image surface and blit it to main surface
		{
			sgp::VideoSurfacePtr_t p_surface =  VideoManager_.create_surface(
//				ImageManager.load_image(boost::filesystem::path("LOADSCREENS")/"Notification.sti"), sgp::VideoSurface::MU_SYSTEM, sgp::Image::TBF_DEFAULT);
				ImageManager.load_image(boost::filesystem::path("INTERFACE")/"SIRTECHSPLASH.STI"), sgp::VideoSurface::MU_SYSTEM, sgp::Image::TBF_DEFAULT);
			VideoManager_.get_main_surface(sgp::VideoManager::ST_FRAME_BUFFER).blit(*p_surface, Settings_.offset_width(), Settings_.offset_height(), 0, nullptr);
		}
		// Show notification
		for(std::uint_least32_t splash_start_time = TimerManager_.get_clock(); splash_start_time + 5500 > TimerManager_.get_clock();)
		{
			//Allow the user to pick his bum.
			VideoManager_.invalidate_screen();
			VideoManager_.refresh_screen();
		}
*/
		// Show splash
		{
			sgp::VideoSurfacePtr_t p_surface =  VideoManager_.create_surface(
				ImageManager.load_image(boost::filesystem::path("INTERFACE")/"splash.sti"), sgp::VideoSurface::MU_SYSTEM, sgp::Image::TBF_DEFAULT);
//x			GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH );
			VideoManager_.get_main_surface(sgp::VideoManager::ST_FRAME_BUFFER).blit(*p_surface, Settings_.offset_width(), Settings_.offset_height(), 0, nullptr);
		}
		VideoManager_.invalidate_screen();
		VideoManager_.refresh_screen();

//x		guiSplashStartTime = GetJA2Clock();
	}
} /*ja2*/